package com.lindroy.androidplayer.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.ViewDataBinding
import com.lindroy.androidplayer.utils.getViewBinding

/**
 * @author Lin
 * @date 2022/1/7
 * @function 基类 Activity
 */
abstract class BaseActivity<VB : ViewDataBinding> : AppCompatActivity() {

    val mBinding: VB by lazy(mode = LazyThreadSafetyMode.NONE) { getViewBinding(layoutInflater) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(mBinding.root)
        mBinding.initView(savedInstanceState)
        mBinding.initListener()
    }

    abstract fun VB.initView(savedInstanceState: Bundle?)

    abstract fun VB.initListener()

}